﻿@model  DataAccess.Models.Alimama

<script src="~/Scripts/plugins/jquery.min.js"></script>
<script src="~/Scripts/plugins/layer/layer.min.js"></script>

@section Scripts{
    <script type="text/javascript">

        var index = parent.layer.getFrameIndex(window.name);

        $(function () {

            $("#cancel").click(function () {
                //parent.$("#handle_status").val('1112');
                //alert(parent.$("#handle_status").val());
                //parent.location.reload();
                parent.layer.close(index);
            });

           // $(".chosen-select").chosen();

            $("#submit").bind("click", Save);

        })

        function Save() {
            var username = $.trim($("input[name=username]").val());
            if (username.length == 0) {
                layer.tips('用户名不能为空！', 'input[name=username]', { tips: [2, '#78BA32'] });
                return false;
            }

            var password = $.trim($("input[name=password]").val());
            if (password.length == 0) {
                layer.tips('密码不能为空！', 'input[name=password]', { tips: [2, '#78BA32'] });
                return false;
            }
             
            var state = $("#state").val();
            var id = $("#id").val();
            var remark = $("#remark").val();

            common.invokeApi(
                "post",
                "/editedAlimama.html",
                //"id=" + id + "&state=" + state + "&username=" + username + "&password=" + password + "&nickname=" + nickname + "&tel=" + tel,
                { id: id, state: state, username: username, password: password, remark: remark },
                function () { },
                function (data) {
                    common.msg(data.Message, 1, function () {
                        window.location.href = "/alimamas.html";
                       // parent.location.reload();
                        //parent.layer.close(index);
                    });
                },
                function (data) {
                    common.msg(data.Message, 2);
                    window.location.href = "/alimamas.html";
                    //parent.layer.close(index);
                },
                function () { }
                );
        }



    </script>
    <script src="~/Scripts/plugins/validate/jquery.validate.min.js"></script>
    <script src="~/Scripts/plugins/validate/messages_zh.min.js"></script>
    <script src="~/Scripts/plugins/bootstrap.min.js"></script>
    <script src="~/Scripts/plugins/content.min.js"></script>
    <script src="~/Scripts/sys/lib/common_raw.js"></script>
}










<div class="row">
    <div class="col-lg-12">
        <div class="row">
            <div class="col-lg-12">
                <ol class="breadcrumb">
                    <li><a href="#">系统管理</a></li>
                    <li class="active"><span>阿里妈妈联盟账号</span></li>
                </ol>
                <h1>新增修改阿里妈妈联盟账号</h1>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="main-box">
                    <header class="main-box-header clearfix">
                        <h2></h2>
                    </header>
                    <div class="main-box-body clearfix">
                        <form class="form-horizontal" role="form" method="post" >
                            <input type="hidden" id="id" name="id" value="@(Model.id)" />
                            <div asp-validation-summary="All" class="text-danger"></div>
                            <div class="form-group">
                                <label for="RoleId" class="col-lg-2 control-label">用户名:</label>
                                <div class="col-lg-2">
                                    <input type="text" id="username" name="username" max="10" value="@(Model.username)" @(Model.id != 0 ? "readonly=\"readonly\"" : "") class="form-control" placeholder="输入用户名">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="PermissionId" class="col-lg-2 control-label">密码:</label>
                                <div class="col-lg-2">
                                    <input type="text" id="password" name="password" maxlength="10" value="@(Model.password)" class="form-control" placeholder="输入密码">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="state" class="col-lg-2 control-label">状态:</label>
                                <div class="col-lg-2">
                                    <select class="form-control" name="state" id="state">
                                        <option value="1" @(Model.state == 1 ? "selected" : "")>启用</option>
                                        <option value="0" @(Model.state == 0 ? "selected" : "")>禁用</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="PermissionId" class="col-lg-2 control-label">备注:</label>
                                <div class="col-lg-2">
                                    <input type="text" id="remark" name="remark" value="@(Model.remark)" maxlength="100" class="form-control" placeholder="输入备注">
                                </div>
                            </div>
                         

                            <div class="form-group">
                                <div class="col-lg-offset-2 col-lg-10">
                                    <button type="submit" class="btn btn-success">保 存</button>  
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>




    </div>
</div>